﻿CREATE TABLE [dbo].[TeacherSubjects]
(
	[SchoolYearID] INT NOT NULL, 
    [TeacherID] INT NOT NULL  PRIMARY KEY, 
    [ClassID] INT NOT NULL, 
    [SubjectID] INT NOT NULL,
	CONSTRAINT FK_TeacherSubjects_SchoolYears FOREIGN KEY (SchoolYearID) 
    REFERENCES SchoolYears (SchoolYearID) 
    ON DELETE CASCADE
    ON UPDATE CASCADE,
	CONSTRAINT FK_TeacherSubjects_Teachers FOREIGN KEY (TeacherID) 
    REFERENCES Teachers (TeacherID) 
    ON DELETE CASCADE
    ON UPDATE CASCADE,
	CONSTRAINT FK_TeacherSubjects_Classes FOREIGN KEY (ClassID) 
    REFERENCES Classes (ClassID) 
    ON DELETE CASCADE
    ON UPDATE CASCADE,CONSTRAINT FK_TeacherSubjects_Subjects FOREIGN KEY (SubjectID) 
    REFERENCES Subjects (SubjectID) 
    ON DELETE CASCADE
    ON UPDATE CASCADE
)
